<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <div id="app">
    {{msg}}==={{n}}
    <hr />
    <button v-on:click="n++">按钮 v-on:</button>
    <button @click="n++">按钮==@</button>
    <button @click="btn(5)">按钮==函数</button>
    <button @click="handle">点击我控制h1盒子显示和影藏</button>
    <h1 v-show="flag">我是一个盒子</h1>
  </div>


  <script src="https://cdn.bootcdn.net/ajax/libs/vue/2.7.14/vue.min.js"></script>

  <script>
    var vm = new Vue({
      el: "#app",
      data: {
        msg: 'hello  vue',
        msg1: '<div>我是一个div</div>',
        msg2: '<div>我是一个div2222</div>',
        flag: true,
        n: 6
      },
      methods: {
        btn (x) {
          console.log(this.n, 111);
          this.n += x
        },
        handle () {
          this.flag = !this.flag
        }
      }
    })

    // console.log(vm, 2222);
  </script>
</body>

</html>